/*
 * @Date: 2023-01-08 13:47:28
 * @LastEditors: Zireael 1193875164@qq.com
 * @LastEditTime: 2023-03-21 16:35:41
 * @FilePath: \A19\frontend\src\hooks\initClient.ts
 */
import { getClient } from '@/getClient';
import { ServiceType } from '@/shared/protocols/serviceProto';
import { HttpClient, WsClient } from 'tsrpc-browser';
import pinia from '@/pinia';
import { useClientStore } from '@/pinia/stores/client';
import { sendToken } from '@/flowNodes/sendToken';
import { errorHandle } from '@/flowNodes/errorHandle';
import { encry } from '../flowNodes/encry';

const initClient = (client:HttpClient<ServiceType>) => {

    //flows
    encry(client)
    sendToken(client)
    errorHandle(client)

    //ws bs connect
    // const res = await client.connect()
    // if(res.isSucc){
    //     console.log('connected');
    // store.client = client
    // }
    // else{
    //     ElMessage.error('fail to connect to server')
    //     throw new Error("fail to connect to server");
    // }
}

export {
    initClient
}